Add versioned Lambda asset uploads#6859
Draft
iloewensen wants to merge 1 commit intoanomalyco:devfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in Lambda code asset path controlled by
SST_LAMBDA_CODE_ASSET_VERSIONING.When enabled, SST uploads Lambda zip assets to a stable S3 key and updates the existing
BucketObjectv2usingsourceHash. Lambda functions then reference the uploaded object version throughs3ObjectVersion.Motivation
Large deployments with many Lambda functions currently create a new S3 object key for every function code change. In testing with 250 functions, this caused significant S3 object churn and larger Pulumi state updates.
Measured results from the investigation:
CloudTrail and Pulumi debug logs did not show AWS throttling as the primary bottleneck. The remaining cost appears to be Lambda control-plane update latency across many functions.
Changes
SST_LAMBDA_CODE_ASSET_VERSIONING=1/true.lambda/<app>/<stage>/<function>/code.zip.sourceHashon theBucketObjectv2so Pulumi updates the same object when code changes.s3ObjectVersionto Lambda so code updates point at the exact uploaded object version.Compatibility
Default behavior is unchanged when
SST_LAMBDA_CODE_ASSET_VERSIONINGis not set.Dev bridge code keeps the existing hashed
assets/dev-bridge-code-<hash>.zipbehavior.